class SIMPLE_NOTEPAD_2

inherit
	IUP_INTERFACE

create {ANY}
   make

feature {ANY}

	exit_cb (widget: IUP_MENU_ITEM): STRING
		do
			Result := "IUP_CLOSE"
		end

	make
      local
			i: STRING
			gui: IUP
			ml: IUP_MULTILINE
			v: IUP_VBOX
			w: IUP_DIALOG
			item_exit, item_open, item_save_as: IUP_MENU_ITEM
			sep: IUP_MENU_SEPARATOR
			file_menu, menu: IUP_MENU
			sub1_menu: IUP_SUBMENU
		do
			gui := iup_open
			
			create ml.multiline
			ml.expand_both_directions
			
	      create v.vbox({ARRAY[IUP_WIDGET]} << ml >>)

			create item_open.item("Open")
			item_open.set_hide_mark(True)

			create item_save_as.item("Save As")
			item_save_as.set_hide_mark(True)

			create item_exit.item("Exit")
			item_exit.set_hide_mark(True)
			item_exit.set_cb_action(agent exit_cb)

			create sep.separator

			create file_menu.menu({ARRAY[IUP_MENU_ELEMENT]} << item_open, item_save_as, sep, item_exit >>)

			create sub1_menu.submenu("File", file_menu)
			create menu.menu({ARRAY[IUP_MENU_ELEMENT]} << sub1_menu >>)
			
	      create w.dialog(v)
			w.set_menu_widget(menu)
			w.set_title("Simple Notepad")
			w.set_predefined_size("QUARTER", "QUARTER")
			
	      i := w.show_predefined_xy("IUP_CENTER", "IUP_CENTER")
			w.set_user_size(0, 0)
			
         gui.main_loop
			gui.close
		end

end

